% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/aggregate.R
\name{cy.day_mean}
\alias{cy.day_mean}
\title{Year-wise day-weighted aggregation}
\usage{
cy.day_mean(x, dates = NULL, by = NULL, ...)
}
\arguments{
\item{x}{Either a \code{data.frame} or \code{matrix}}

\item{dates}{\code{DateVector} evaluated within the context of
\code{x} if \code{x} is a \code{data.frame} containing
\code{date.col} as a column. Can also specify "row.names" to
access dates stored as rownames attributes of \code{x}.}

\item{by}{Additional grouping variables to split \code{x} before
applying the aggregation. Like \code{dates}, if \code{x} is a
\code{data.frame}, then \code{by} will be evaluated within the
context of \code{x}.}

\item{...}{Additional arguments passed to
\code{\link[parallel]{mcMap}}.}
}
\description{
Split-apply-combine style year-wise aggregation from country-date
to country-year using the aggregate function \code{\link{day_mean}}.
}
\details{
\code{to_cy} aggregates from country-date level to
    country-year level by splitting the data year-wise based on the
    specified \code{DateVector}. The aggregation is done by the
    \code{day_mean} function, which takes a day-weighted average.
}
\examples{
df <- data.frame(historical_date = as.Date(c("1900-01-01", "1900-03-01", "1900-07-11")),
                 code = c(1, 2, 1))
cy.day_mean(df, historical_date)

}
